home *** CD-ROM | disk | FTP | other *** search
- unit Bdeinfo;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, ExtCtrls, DbiErrs, DbiProcs, DbiTypes;
-
- type
- TForm1 = class(TForm)
- Panel1: TPanel;
- GroupBox1: TGroupBox;
- GroupBox2: TGroupBox;
- chkShare: TCheckBox;
- edNetType: TEdit;
- edNetUser: TEdit;
- edINIFile: TEdit;
- edLDriver: TEdit;
- lbBufsize: TLabel;
- lbHeap: TLabel;
- lbDrivers: TLabel;
- lbClients: TLabel;
- lbSessions: TLabel;
- lbDatabase: TLabel;
- lbCursors: TLabel;
- Label8: TLabel;
- Label9: TLabel;
- Label10: TLabel;
- Label11: TLabel;
- GroupBox3: TGroupBox;
- lbEngVer: TLabel;
- lbDate: TLabel;
- lbTime: TLabel;
- Button1: TButton;
- chkInit: TCheckBox;
- procedure FormCreate(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- procedure GetIDAPIInfo(DoInit: Boolean);
- end;
-
- var
- Form1: TForm1;
-
- procedure Check(Code: DBIRESULT);
-
- implementation
-
- {$R *.DFM}
-
- procedure Check(Code: DBIRESULT);
- var szError: array[0..DBIMAXMSGLEN] of char;
- begin
- if Code <> DBIERR_NONE then
- begin
- DbiGetErrorString(Code, szError);
- raise Exception.Create(StrPas(szError));
- end;
- end;
-
- procedure TForm1.GetIDAPIInfo(DoInit: Boolean);
- var SysVer: SYSVersion;
- SysCfg: SYSConfig;
- SysInf: SYSInfo;
- D, M, Hr, Min, Sec: Word;
- Y: Integer;
- thedb : hDBIDb;
- begin
- if DoInit then Check(DbiInit(nil));
-
- Check(DbiGetSysVersion(SysVer));
- Check(DbiGetSysConfig(SysCfg));
- Check(DbiGetSysInfo(SysInf));
-
- with SysInf do
- begin
- lbBufSize.Caption := format('Buffer size: %8d K', [iBufferSpace]);
- lbHeap.Caption := format('Heap size: %8d K', [iHeapSpace]);
- lbDrivers.Caption := format('Loaded drivers: %6d', [iDrivers]);
- lbClients.Caption := format('Active clients: %8d', [iClients]);
- lbSessions.Caption := format('Sessions: %9d', [iSessions]);
- lbDatabase.Caption := format('Open databases: %3d', [iDatabases]);
- lbCursors.Caption := format('Cursors: %10d', [iCursors]);
- end;
-
- with SysCfg do
- begin
- chkShare.Checked := Boolean(bLocalShare);
- edNetType.Text := StrPas(szNetType);
- edNetUser.Text := StrPas(szUserName);
- edINIFile.Text := StrPas(szIniFile);
- edLDriver.Text := StrPas(szLangDriver);
- end;
-
- Check(DbiDateDecode(SysVer.dateVer,M,D,Y));
- Check(DbiTimeDecode(SysVer.timeVer,Hr, Min, Sec));
- Sec := Sec div 1000;
-
- lbEngVer.Caption := format('Engine version: %f', [SysVer.iVersion/100]);
- lbDate.Caption := format('Date: %.2d/%.2d/%d', [D,M,Y]);
- lbTime.Caption := format('Time: %.2d:%.2d:%.2d', [Hr, Min, Sec]);
-
- if DoInit then Check(DbiExit);
- end;
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- GetIDAPIInfo(False);
- end;
-
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- GetIDAPIInfo(chkInit.Checked);
- end;
-
- end.
-